define(function () {
    'use strict';

    function ctrl($scope, $state, $sce,$stateParams, WebService) {
        function init() {
            WebService.getEncontract($stateParams.id).then(function (data) {
                $scope.agreement = data;
                $scope.agreement.econtract_content = $sce.trustAsHtml($scope.agreement.econtract_content);
            });
        }

        $scope.$on('$ionicView.beforeEnter', function () {
            init();
        });
        $scope.back = function () {
            $state.go('tab.account-agreementlist');
        }
    }

    ctrl.$inject = ['$scope', '$state','$sce', '$stateParams', 'WebService'];
    return ctrl;
});
